package com.sprouting.personal.model.entity;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.sprouting.personal.annotations.CheckNotNull;
import com.sprouting.personal.model.common.BaseModel;
import com.sprouting.personal.model.common.jsr.AddGroup;
import com.sprouting.personal.model.common.jsr.UpdGroup;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.Null;
import java.util.Date;

/**
 * 家庭作业记录
 *
 * @author ：LX（长沙麓谷）
 * @date 创建时间： 2023/7/15 10:30
 */
@TableName("ps_homework_record")
@Data
public class HomeworkRecord extends BaseModel {

    /**
     * 主键
     */
    @TableId
    @CheckNotNull(message = "非法ID", groups = UpdGroup.class)
    @Null(message = "无效ID", groups = AddGroup.class)
    private String id;
    /**
     * 隶属用户ID
     * @see User#getId()
     */
    private String userId;
    /**
     * 家庭成员ID
     * @see MemberFamily#getId()
     */
    private String memberFamilyId;
    /**
     * 家庭作业ID
     * @see Homework#getId()
     */
    private String homeworkId;
    /**
     * 作业提交时间
     * 提交的是哪天的作业
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern="yyyy-MM-dd", timezone = "GMT+8")
    private Date submitTime;
    /**
     * 作业是否补交的
     * @see com.sprouting.personal.interfaces.common.Constant.YesOrNo#NO 非补交的作业
     */
    private Integer supplementary;
}
